﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Odelle.Utils.Comparisons
{
    public class NumberComparator
    {
        public virtual bool Compare(int value, string formatValue)
        {
            int fv = 0;
            bool result = true;

            result &= int.TryParse(formatValue, out fv);
            result &= (value == fv);

            return result;
        }

        public virtual bool Compare(long value, string formatValue)
        {
            long fv = 0;
            bool result = true;

            result &= long.TryParse(formatValue, out fv);
            result &= (value == fv);

            return result;
        }

        public virtual bool Compare(float value, string formatValue)
        {
            float fv = 0F;
            bool result = true;

            result &= float.TryParse(formatValue, out fv);
            result &= (value == fv);

            return result;
        }

        public virtual bool Compare(double value, string formatValue)
        {
            double fv = 0.0;
            bool result = true;

            result &= double.TryParse(formatValue, out fv);
            result &= (value == fv);

            return result;
        }

        public virtual bool Compare(DateTime value, string formatValue)
        {
            DateTime fv ;
            bool result = true;

            result &= DateTime.TryParse(formatValue, out fv);
            result &= (value == fv);

            return result;
        }
    }
}
